<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title></title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<script>
		document.addEventListener('DOMContentLoaded', function() {
			document.documentElement.style.fontSize = document.documentElement.clientWidth / 1000 + 'px'
		})
	</script>
	<!--标准mui.css-->
	<link rel="stylesheet" href="css/mui.min.css">
	<!--自定义css-->
	<link rel="stylesheet" href="css/zui.css">
</head>
<body>
<header class="mui-bar mui-bar-nav">
	<a class="mui-action-back mui-icon"></a>
	<h1 class="mui-title">CAVLab</h1>
</header>
<div id="app-submit">
	<div class="mui-content" style="padding-top : 60px; margin-left:10px;margin-right: 10px">
		<form class="mui-input-group">
			<div class="mui-input-row" style="font-size:18px">
				<label>Q</label>
				<input v-model="Q" type="text" placeholder="e.g. FCW">
			</div>
			<div class="mui-button-row">
				<button type="button" class="mui-btn mui-btn-warning" @click="search">搜索</button>&nbsp;&nbsp;
				<button type="button" class="mui-btn mui-btn-primary" @click="baidu">百度</button>&nbsp;&nbsp;
				<button type="button" class="mui-btn mui-btn-green" @click="xueshu">学术</button>&nbsp;&nbsp;
				<button type="button" class="mui-btn mui-btn-danger" @click="reset">清空</button>
			</div>
		</form>
	</div>
	<div class="mui-content" style="margin-left:10px;margin-right: 12px">
		<ul class="mui-table-view" style="font-size:10px">
			<li class="mui-table-view-cell" v-html="A"></li>
			<li class="mui-table-view-cell"> <span style="color: #1677FF;margin-left: 5px;" @click="copyA(A)"> 复制 </span> </li>
			
		</ul>
	</div>
	<div id="footer">
		CAVLab @{{year}}
		<a href="https://blog.csdn.net/qq_41854291?type=blog">zolty</a>
	</div>
</div>
<script src="js/vue.min.js"></script>
<script src="js/index.min.js"></script>
<script src="js/moment.min.js"></script>
<script src="js/selectList.js?v2"></script>
<script src="js/underscore-min.js"></script>
<script>
	var vm = new Vue({
		el: "#app-submit",
		data: {
			Q : "",
			A : "Waiting for your search...",
			year : moment().format("YYYY")
		},
		methods: {
			baidu(){
				window.open('https://www.baidu.com/s?wd=' + this.Q);
			},
			xueshu(){
				window.open('https://xueshu.baidu.com/s?wd=' + this.Q);
			},
			reset(){
				this.Q = "";
			},
			search() {
				var a = "";
				for (var i=0; i<cav_list.length; i++)
				{ 
					if(this.Q.toUpperCase().trim()==cav_list[i].simpleName)
					{
						a += cav_list[i].simpleName + '('+ cav_list[i].fullName + '):' + cav_list[i].description+"<br>";
					}
				}
				if(a=="")
				{
					this.A = "Sorry, I don't know. If you want, you can send the results to my email (zolty@qq.com)."
				}
				else{
					this.A = a;
				}
			},
			copyA(aname) {
			var input = document.createElement("input"); // 创建input对象
			input.value = aname.replace("<br>",""); // 设置复制内容
			document.body.appendChild(input); // 添加临时实例
			input.select(); // 选择实例内容
			document.execCommand("Copy"); // 执行复制
			document.body.removeChild(input); // 删除临时实例
			alert("成功复制查询结果");
			},
		}
	});
</script>
</body>
</html>